package com.example.demo.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;

/**
 * @Question StudentController
 * @Date 2022/11/24 21:21
 * @Solution
 */
@RestController
public class StudentController {
    @RequestMapping("/hi")
    public String sayHi(String name) {
        return name;
    }
    @PostMapping("/m6/{name}/{pass}")
    public String fun(@PathVariable String name,@PathVariable String pass) {
        return name+pass;
    }
    @RequestMapping("/param9")
    public String param9(String name, @RequestPart("myfile") MultipartFile file) throws IOException {
        file.transferTo(new File("D://s.png"));
        return "";
    }
    @RequestMapping("/get_head")
    public String getHead(@RequestHeader("User-Agent") String userAgent) {
        return userAgent+"sd"+"sdasas";
    }
}
